export type classificationReqPramesType = {
    categoryId?: number,
    categoryName: string,
    parentCategoryId?: number,
    sub?: boolean
}

export type addOrEditType = 'addFirst'|'editFirst'|'addSub'|'editSub';

export type ClassStateType = {
    prames: classificationReqPramesType,
    data: classificationResType,
    addOrEdit: boolean,
    type: addOrEditType,
    dataItem: selectItem
}

export type ClassReducerType = { type: "SET_PRAMES", payLoad: classificationReqPramesType } |
{ type: "CLEAR_PRAMES" } |
{ type: "SET_RESDATA", payLoad: classificationResType } |
{ type: "CHANGE_ADDOREDIT", payLoad: boolean } |
{ type: "CHANGE_TYPE", payLoad: addOrEditType }|
{ type: "SET_DATAITEM", payLoad: selectItem };


export type ContextType = { state: ClassStateType, dispatch: React.Dispatch<ClassReducerType> }


export type classificationPaginationType = {
    page: number,
    size: number
}

export interface classificationReqType extends classificationReqPramesType {
    paging: classificationPaginationType
}

export type classificationResDataType = {
    categoryId: number,
    parentCategoryId: number,
    categoryName: string,
    createTime: number,
    updateTime: number,
    level: number,
    sub?: classificationResDataType[]
}

export type classificationResType = {
    count: number,
    data: classificationResDataType[]

}


export type classificationFormType = {
    categoryName: string
}

export type classificationFormReqType = {
    categoryId?:number,
    parentCategoryId: number,
    categoryName: string,
    level: number
}

export type selectItem = {
    categoryId?: number,
    level: number,
    parentCategoryId:number
}

export type classificationDetailsReqType = {
    categoryId: number
}
